<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>原型继承实现</title>
</head>

<body>
  <script>
    // ============================== 原型继承 ==============================
    function Person(){
      this.eyes = 2
      this.ears = 2
    }
    Person.prototype.eat = function(){
      console.log('eat')
    }
    function Man() {

    }
    function Woman() {
      
    }
    Man.prototype = new Person()
    Woman.prototype = new Person()

    Man.prototype.constructor = Man
    Woman.prototype.constructor = Woman

    const zs = new Man()
    const xh = new Woman()

    zs.eat()
    xh.eat()

    Woman.prototype.born = function(){
      console.log('生孩子')
    }
    // console.log(zs.born())
    xh.born()
  </script>
</body>

</html>